'''To create a few files following Pro/Engineer naming rule.
'''
import os

def GenerateFile(fileName):
    try:
        FILE = open(fileName, "w")
    except IOError:
        print "Failed to create " + fileName
    finally:
        FILE.close()

root_dir = r"E:\CSharpProject\M0002\MockFiles" + os.sep
if not os.path.exists(root_dir):
    os.mkdir(root_dir)
    print root_dir, 'created.'
extensions = ['asm', 'dgm', 'drw', 'frm', 'lay', 'mfg', 'mrk', 'prt', 'rep', 'sec']
prefix = 'sample'
file_number = 32
for i in range(0, file_number-1):
    entension_index = i % len(extensions)
    #print entension_index
    file_name = root_dir + prefix + "." + extensions[entension_index] + "." + str(i)
    print file_name
    GenerateFile(file_name)
else:
    print file_number, " files has generated successfully."
    

    
